package in.muton.edushare.components.calendar.api;

import in.muton.edushare.wicket.models.CayenneList;

import java.util.List;

import org.apache.wicket.model.IModel;

public class UniqueElementList<T> extends CayenneList<T> {
	private static final long serialVersionUID = 9178346704920905840L;

	public UniqueElementList(List<T> rawObjList) {
		super(rawObjList);
	}

	public UniqueElementList<T> add(T obj) {
		List<IModel<T>> mod = this.getObject();
		for (IModel<T> t : mod) {
			if (t.getObject().equals(obj))
				return this;
		}
		super.add(obj);
		return this;
	}
}
